[박수훈] sprint7#78
Hidden character warning
Conversation
- 상품 등록 유효성 검사 (Custom Hook) 및 태그 칩 기능 구현 - 상품 등록 페이지 반응형 레이아웃(Mobile/Tablet/PC) 적용 - Header 및 RegistrationPage CSS 파일 분리 (스타일 충돌 해결) - App.jsx 상세 페이지 라우팅 오류 수정
| const response = await fetch(`${BASE_URL}/products?${query}`); | ||
|
|
||
| if (!response.ok) { | ||
| throw new Error(`데이터 로딩 실패: ${response.status}`); |
There was a problem hiding this comment.
실패해서 에러 던지면 서버에서 html을 send해줄 수 있나요?
예외처리가 필요하지 않을까요?
| // (구 signup.html) 회원가입 화면 ('/signup') | ||
|
|
||
| import Link from 'next/link'; | ||
| import '../../../styles/Login.css'; |
There was a problem hiding this comment.
alias나 ../../../를 지양하면 좋을거 같네요
| const [content, setContent] = useState(''); | ||
|
|
||
| useEffect(() => { | ||
| const loadArticle = async () => { |
There was a problem hiding this comment.
훅으로 빼는건 어떨까요?
로딩, 에러를 추가해보는건 어떨까요?
서버컴포넌트로 뺼 여지도 좀 있는거 같은데 그런 부분도 고민해보세요
| const API_URL = process.env.NEXT_PUBLIC_API_URL || 'http://localhost:5001/api'; | ||
|
|
||
| // 상대 시간 변환 함수 | ||
| const getRelativeTime = (dateString) => { |
There was a problem hiding this comment.
이런건 시간 utils로 빼도 좋을거 같아요
| createComment, | ||
| updateComment, | ||
| deleteComment, | ||
| } from '../../../../../api/api'; |
There was a problem hiding this comment.
왜 api폴더 안에 api파일이 있는걸까요?
index로도 충분해보입니다.
|
|
||
| // 1. 유효성 검사 규칙 (심화 요구사항 반영) | ||
| // - 상품명: 10자 이내 | ||
| const validateName = (val) => { |
There was a problem hiding this comment.
val보다는 그냥 name이 들어오면 좋을거 같아요
| !priceInput.error; | ||
|
|
||
| // 5. 제출 핸들러 | ||
| const handleSubmit = async (e) => { |
There was a problem hiding this comment.
form 관련 로직만 전부 커스텀 훅으로 뺴보는건 어떨까요?
| import styles from '../App.module.css'; | ||
|
|
||
| const BestProductList = () => { | ||
| const [bestProducts, setBestProducts] = useState([]); |
There was a problem hiding this comment.
로딩, 에러 상태가 들어가면 좋을거 같아요 + 커스텀 훅도요
| const [totalCount, setTotalCount] = useState(0); | ||
| const [order, setOrder] = useState('recent'); | ||
| const [keyword, setKeyword] = useState(''); | ||
| const [page, setPage] = useState(1); |
There was a problem hiding this comment.
page말고 index 써주시고 0부터 해주시면 더 좋을거 같아요
|
|
||
| const ProductList = () => { | ||
| const [products, setProducts] = useState([]); | ||
| const [totalCount, setTotalCount] = useState(0); |
There was a problem hiding this comment.
totalCount가 따로 필요한가요?
products.length를 사용하면 안되나요?
1. 스프린트 미션 요구사항
기본 요구사항
공통
자유 게시판 페이지
게시글 등록 & 수정 페이지
게시글 상세 페이지
심화 요구사항
공통
2. 주요 변경사항
3. 멘토님에게 남길 메시지